package javatwo.annotation.session2;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

public class MyController {
	
	public void generateMyDoc() {
		
		
		Class myClass = MyClass.class;
		
		Method[] myMethods = myClass.getMethods();
		
		for(Method myMethod : myMethods ) {
			
			System.out.println("Method Name: "+myMethod.getName());
		
			Annotation[] annotations = myMethod.getAnnotations();
				
			for(Annotation annotation:annotations) {
				if( annotation instanceof MyDoc ) {
					MyDoc myDocAnnotation = (MyDoc) annotation;
					
					System.out.println("Author:"+myDocAnnotation.author());
					System.out.println("Description:"+myDocAnnotation.description());
					
					String[] requireNos = myDocAnnotation.requireNos();
					
					System.out.println("Requirement No List as follows:");
					
					for(String requireNo : requireNos) {
						System.out.println(" *"+requireNo);
					}
					
				}
			}
		}
		
	}

}
